﻿#region
using System;
using System.Windows.Forms;
using Y2M.Components;

#endregion

namespace Y2M.Forms
{
    public partial class UrlDownloadForm : Form
    {
        public UrlDownloadForm()
        {
            InitializeComponent();
        }

        public string Url
        {
            get { return txtUrl.Text; }
        }

        public bool AudioOnly
        {
            get { return rdbAudio.Checked; }
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode || RunTimeChecker.IsRunTime == false)
                return;

            string clipboardText = Clipboard.GetText();

            if (string.IsNullOrEmpty(clipboardText))
                return;

            if (YoutubeHelper.GetVideoId(clipboardText) != null)
                txtUrl.Text = clipboardText;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Close();
        }
    }
}